﻿using task1.GenericList;

namespace ch02_3
{
    class Program
    {
        static void Main(string[] args)
        {
            GenericList<int> myList = new GenericList<int>();
            Random rd = new Random();
            for (int i = 0; i < 10; i++)
            {
                myList.Add(rd.Next(-20,100));
            }
            Console.WriteLine("Data:");
            myList.ForEach(d => Console.Write("{0} ",d));
            Console.WriteLine("");
            int maxNum = int.MinValue;
            int minNum = int.MaxValue;
            long sum = 0;
            myList.ForEach(d => {
                if (d >= maxNum) maxNum = d;
                if (d <= minNum) minNum = d;
                sum += d;
            });
            Console.WriteLine(string.Format("Max: {0}\tMin: {1}\tSum: {2}", maxNum, minNum, sum));
        }
    }
}
